package com.spring.bean;
//import jakarta.annotation.PostConstruct;
//import jakarta.annotation.PreDestroy;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.stereotype.Component;
//import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Component
public class Lifecycle {
    private String context;
    private String content;

    public void setContent(String content){
        this.content=content;
    }

    @PostConstruct
    public void init(){
        System.out.println("Bean初始化后，调用init()方法");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("Bean销毁前，调用destroy()方法");
    }
    public void print(){
        System.out.println("输出属性值:"+content);
    }

}
